@echo off

echo target_dir (default = ..\Dependence\xgcBase)
set /P target_dir=

if "%target_dir%"=="" set target_dir=..\Dependence\xgcBase

echo binary_dir (default = ..\Exe)
set /P binary_dir=

if "%binary_dir%"=="" set binary_dir=..\Exe

echo %target_dir%
echo %binary_dir%

goto vs2010
:choice0
cls
echo 1. vs 2008
echo 2. vs 2010
echo 3. vs 2011
echo 0. exit

set /P choice=
if %choice%==1 goto vs2008
if %choice%==2 goto vs2010
if %choice%==3 goto vs2011
if %choice%==0 goto end

goto choice0

:vs2008
set source_dir=vs90
goto choice1

:vs2010
set source_dir=vs100
goto choice1

:vs2011
set source_dir=vs110
goto choice1

:choice1
rem can remove
goto include

cls
echo 1. Include
echo 2. Library
echo 0. exit

set /P choice=
if %choice%==1 goto include
if %choice%==2 goto choice2
if %choice%==0 goto end

goto choice1

:include
if not exist %target_dir% md %target_dir%
if not exist %target_dir%\Include md %target_dir%\Include
if not exist %target_dir%\Include\common md %target_dir%\Include\common
if not exist %target_dir%\Include\json md %target_dir%\Include\json

xcopy common\*.h %target_dir%\Include /y /s
copy netbase\netbase.h %target_dir%\Include /y

pause

:choice2
cls

echo 1. debug
echo 2. debug_ansi
echo 3. release
echo 4. release_ansi
echo 5. include
echo 0. exit

set /P choice=

if %choice%==1 goto debug
if %choice%==2 goto debug_ansi
if %choice%==3 goto release
if %choice%==4 goto release_ansi
if %choice%==5 goto choice1

if %choice%==0 goto end
goto choice2

:debug
set version=Debug
goto work

:debug_ansi
set version=Debug_Ansi
goto work

:release
set version=Release
goto work

:release_ansi
set version=Release_Ansi
goto work

:work

if not exist %target_dir% md %target_dir%
if not exist %target_dir%\Lib\ md %target_dir%\Lib
if not exist %target_dir%\Lib\%version% md %target_dir%\Lib\%version%

copy %source_dir%\bin\%version%\*.dll %binary_dir%\%version% /y
copy %source_dir%\lib\%version%\*.lib %target_dir%\Lib\%version% /y

pause
set %choice%=
echo %choice%
goto choice2

:end
echo publish xgcBase finished...